namespace SPI.AgentServer.Models;

public class QueryResponse
{
    public bool Success { get; set; }
    public string Summary { get; set; } = string.Empty;
    public object? Data { get; set; }
    public List<string> Errors { get; set; } = new();
    public QueryMetadata Metadata { get; set; } = new();
}

public class QueryMetadata
{
    public string SessionId { get; set; } = string.Empty;
    public long ExecutionTimeMs { get; set; }
    public string? ExecutedSql { get; set; }
    public List<string> UsedTools { get; set; } = new();
    public int? RowCount { get; set; }
    
    /// <summary>
    /// 导出链接（当数据量较大时提供）
    /// </summary>
    public ExportLinks? ExportLinks { get; set; }
    
    /// <summary>
    /// 图表配置（自动生成的 ECharts 配置）
    /// </summary>
    public ChartConfig? ChartConfig { get; set; }
}

/// <summary>
/// 导出链接
/// </summary>
public class ExportLinks
{
    /// <summary>
    /// Excel 导出链接
    /// </summary>
    public string ExcelUrl { get; set; } = string.Empty;
    
    /// <summary>
    /// CSV 导出链接
    /// </summary>
    public string CsvUrl { get; set; } = string.Empty;
    
    /// <summary>
    /// 导出提示信息
    /// </summary>
    public string Message { get; set; } = string.Empty;
}

/// <summary>
/// 图表配置
/// </summary>
public class ChartConfig
{
    /// <summary>
    /// 图表类型（bar, line, pie, scatter等）
    /// </summary>
    public string Type { get; set; } = string.Empty;
    
    /// <summary>
    /// ECharts 配置对象
    /// </summary>
    public object? Config { get; set; }
    
    /// <summary>
    /// 图表描述
    /// </summary>
    public string Description { get; set; } = string.Empty;
}
